home *** CD-ROM | disk | FTP | other *** search
- Path: eua.ericsson.se!usenet
- From: euahjn@eua.ericsson.se (Henrik Johansson)
- Newsgroups: comp.lang.c++
- Subject: Re: Get name of current method, class or function automatically?
- Date: 17 Jan 1996 17:16:31 GMT
- Organization: Ericsson Telecom Systems Labs, Stockholm, Sweden
- Distribution: world
- Message-ID: <4djatf$rh9@euas20.eua.ericsson.se>
- References: <4dhaoq$f6l@sunsystem5.informatik.tu-muenchen.de>
- Reply-To: euahjn@eua.ericsson.se
- NNTP-Posting-Host: euas31i2c37.eua.ericsson.se
- NNTP-Posting-User: euahjn
-
- In article <4dhaoq$f6l@sunsystem5.informatik.tu-muenchen.de>, Peter Breitling <breitlip@informatik.tu-muenchen.de> writes:
- > I want to write some debugging functions for my library:
- > i have the problem that i want to pass debugging information along with the
- > name of the method, the linenumber and the file.
- >
- > The macros __FILE__ and __LINE__ are standard C(++). Is there something
- > similar- like __FUNCTION__ or __METHOD__ or __CLASS__ in the scope of the
- > function, method or class?
- >
- > Is such thing planned in future?
- >
- > If not - why? I think such things would be very useful. Or is there any
- > workaround?
-
- I agree about the usefullness of such a thing, but I understand why
- it is not possible today: C/C++ preprocessors does not understand C syntax,
- they just scans for their own preprocessor instructions. A C preprocessor
- can't tell if its inside a function, let alone tell its name. A __FUNCTION__
- `macro' can not be a preprocessor macro because of that.
-
- However, the C/C++ syntax itself could be changed to include the proper tokens
- and translate them to the proper character constants. Very useful IMO.
-
-
-